1. // [js] 屏幕rem适配
$(function () {
    var windowWidth = document.documentElement.clientWidth;
    if (windowWidth <= 750) {
        var htmlfontSize = windowWidth / 15;
        document.querySelector('html').style.fontSize = htmlfontSize + 'px';
    }
    window.addEventListener('resize', function () {
        var windowWidth = document.documentElement.clientWidth;
        if (windowWidth <= 750) {
            var htmlfontSize = windowWidth / 15;
            document.querySelector('html').style.fontSize = htmlfontSize + 'px';
        }
    });
})
2. // [vue] router-link active
// active-class="active"
3. // 截取字符串
function getQueryString(key) {
    var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
    var result = window.location.search.substr(1).match(reg);
    return result ? decodeURIComponent(result[2]) : null;
}
4. // 根据时间编码得到具体时间
function getDateTime(nowtimeStr) {
    var fisrtIndex = nowtimeStr.indexOf('(') + 1;
    var lastIndex = nowtimeStr.lastIndexOf(')')
    var timeStr = nowtimeStr.substring(fisrtIndex, lastIndex);
    var getNowTime = formatDate(timeStr)
    return getNowTime
}
// 获取指定具体时间
function formatDate(time) {   
    var dt = new Date(parseInt(time));
    var year = dt.getFullYear();
    var month = dt.getMonth() + 1 < 10 ? '0' + (dt.getMonth() + 1) : (dt.getMonth() + 1);
    var date = dt.getDate() < 10 ? '0' + dt.getDate() : dt.getDate();
    var hour = dt.getHours() < 10 ? '0' + dt.getHours() : dt.getHours();
    var min = dt.getMinutes() < 10 ? '0' + dt.getMinutes() : dt.getMinutes();
    var sec = dt.getSeconds() < 10 ? '0' + dt.getSeconds() : dt.getSeconds();
    return year + "-" + month + "-" + date + " " + hour + ":" + min + ":" + sec;
}
// 获取当前时间
function getNowFormatDate() {
    let date = new Date();
    let year = date.getFullYear();
    let month = (date.getMonth() + 1) < 10 ? "0" + (date.getMonth() + 1) : (date.getMonth() + 1);
    let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    let hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    let min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    let sec = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    let nowDate = year + '年' + month + '月' + day + '日' + hour + ':' + min + ':' + sec;
    return nowDate;
}
5. // swiper插件轮播图
// 轮播图
function returnDetailSwipper() {
    var mySwiper = new Swiper('.swiper-container', {
        // autoplay: true, //可选选项，自动滑动
        autoplay: {
            delay: 3000,
            disableOnInteraction: false, // 用户操作后，继续轮播
        },
        loop: true,
        speed: 500,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
            renderBullet: function (index, className) {
              return '<li class="' + className + '">' + (index + 1) + '</li>';
            },            
            bulletElement: 'li', // 更改标签为li
        }
    })
    if (mySwiper.slides.length <= 3) {
        mySwiper.destroy();
    }
}
6. // 将得到的数据保留最后2位小数
function getFloatTwoNum(str) {
    let num;
    str = str + '';
    let dotIndex = str.indexOf('.');
    if (dotIndex != -1) {
        num = str.substring(0, (dotIndex + 3));
    } else {
        num = str;
    }
    return num
}